package com.tm.d6_inner_class4;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * 2024/5/22 Cjj 匿名内部类 14:56
 */
public class Test {
    public static void main(String[] args) {
        //拓展：搞清楚匿名内部类在开发中的真实使用场景。
        //GUL编程
        //1.创建窗口
        JFrame win = new JFrame("登录界面");
        JPanel panel = new JPanel();
        win.add(panel);

        JButton button = new JButton("登录");
        panel.add(button);

   /*     button.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {

            }
        });*/

        button.addActionListener(e -> JOptionPane.showInternalMessageDialog(win,"登录一下"));

        win.setSize(400,400);
        win.setLocationRelativeTo(null);
        win.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        win.setVisible(true);



    }
}
